home *** CD-ROM | disk | FTP | other *** search
/ Photography Workshop / PhotoWorkShop.iso / pc / Content / Pref / Pref.cst / 00001_Pref Script.ls next >
Encoding:
Text File  |  2002-04-12  |  3.3 KB  |  112 lines

  1. property theSlider
  2. property IndexSize
  3. property indexRect
  4. property VolumeBar
  5. property ancestor
  6. property theVolumeIndex
  7. property CreditsTimer
  8. property CreditsInterval
  9. property CreditsPageIndex
  10. property CreditsPage
  11. property savedCreditsLocation
  12.  
  13. on Birth me, theChannelObject, theName, thePageInfo
  14.   set the ancestor of me to Birth( script "Master Page Template", theChannelObject, theName, thePageInfo, true, true )
  15.   
  16.   set theVolumeIndex to the soundlevel -- GetPreference( #SoundVolume )
  17.   
  18.   set Volumebar to FindDisplay( me, "V" )
  19.   
  20.   set theClickArea to FindButton( me, "ClickArea" )
  21.   set the soundname of theClickArea to ""
  22.   
  23.   set theSlider to FindButton( me, "VTHUMB" )
  24.   set the trackable of theSlider to true
  25.   set the trackRect of theSlider to rect( 185, 118, 185, 310 )
  26.   set indexRect to rect( 185, 108, 185, 320 )
  27.   set IndexSize to ( ( the bottom of indexRect - the top of indexRect ) / 8 )
  28.   set the soundname of theSlider to ""
  29.   
  30.   set CreditsTimer to the Ticks
  31.   set CreditsInterval to 6 * 60
  32.   set CreditsPageIndex to "1"
  33.   set CreditsPage to FindDisplay( me, "CreditsPage" )
  34.   setink( CreditsPage, #copy )
  35.   set savedCreditsLocation to the location of CreditsPage
  36.   Move( CreditsPage, Point(-1000,-1000) )
  37.   
  38.   SetSlider me
  39.   Show me
  40.   return me
  41. end
  42.  
  43. on Leave me
  44.   WritePreferences()
  45. end
  46.  
  47. on SetSlider me
  48.   set theLocation to duplicate(the location of theslider)
  49.   set theLocV to the bottom of indexRect - ( theVolumeIndex * IndexSize ) - ( IndexSize / 2 )
  50.   setat( theLocation, 2, theLocV )
  51.   move( theSlider, theLocation )
  52.   set the soundLevel to theVolumeIndex
  53.   playsound( "Basic Button" )
  54.   if theVolumeIndex >= 0 then
  55.     SetCastName( VolumeBar, "V" & theVolumeIndex )
  56.     Show( VolumeBar )
  57.   else
  58.     Hide( VolumeBar )
  59.   end if
  60. end
  61.  
  62. on PageIdle me
  63.   PageIdle the ancestor of me
  64.   
  65.   if CreditsTimer + CreditsInterval < the ticks then
  66.     case CreditsPageIndex of
  67.       "1":
  68.         set CreditsPageIndex to "2"
  69.         SetCastName( CreditsPage, "VOL_2" )
  70.         Move( CreditsPage, savedCreditsLocation )
  71.       "2":
  72.         set CreditsPageIndex to "3"
  73.         SetCastName( CreditsPage, "VOL_3" )
  74.       "3":
  75.         set CreditsPageIndex to "4"
  76.         SetCastName( CreditsPage, "VOL_4" )
  77.       "4":
  78.         Move( CreditsPage, Point(-1000,-1000) )
  79.         set CreditsPageIndex to "1"
  80.     end case
  81.     set CreditsTimer to the ticks
  82.     show me
  83.   end if
  84. end
  85.  
  86. on ChangePage me, theElementID, theValue1, theValue2
  87.   ChangePage( the ancestor of me, theElementID, theValue1, theValue2 )
  88.   case theElementID of
  89.     #Cancel:
  90.       set the soundLevel to GetPreference( #SoundVolume )
  91.       QueueCommand([[ #GoBack ]] )
  92.     #Done:
  93.       SetPreference( #SoundVolume, theVolumeIndex )
  94.       QueueCommand([[ #GoBack ]] )
  95.     #VolumeClick:
  96.       set theMouseV to the mousev
  97.       if theMouseV > the bottom of indexRect then
  98.         set theMouseV to the bottom of indexRect
  99.       end if
  100.       if theMouseV < the top of indexRect then
  101.         set theMouseV to the top of indexRect
  102.       end if
  103.       set theVolumeIndex to ( ( the bottom of indexRect - theMouseV ) / IndexSize ) 
  104.       put theVolumeIndex
  105.       SetSlider me
  106.     #VolumeSlider:
  107.       set theLocation to the location of theslider
  108.       set theVolumeIndex to ( ( the bottom of indexRect - getat( theLocation, 2 ) ) / IndexSize ) 
  109.       put theVolumeIndex
  110.       SetSlider me
  111.   end case
  112. end